<{*丸子妈妈——积分商城首页 列表形式*}>
<{include file="top_v2.html" }>
<link rel="stylesheet" href="<{$preStaticUrl}>Wap/v2/css/swiper-3.3.1.min.css" />
</head>
<body>
<div id="wrap" class="pb">
    <{*轮播*}>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <{foreach from=$marquee key=key item=item}>
            <div class="swiper-slide">
                <a href="<{u('index/marqueJump?id='|cat:$item.id)}>"><img src="<{$preUploadUrl}><{$item.pic}>" alt="" /></a>
            </div>
            <{/foreach}>
        </div>
    </div>

    <div class="handlers" style="display: none;">
        <a href="<{U('Point/pointDetail')}>" class="score"><{$userinfo.point}>积分</a>
        <a href="<{U('PointMall/exchangeLog')}>" class="record">兑换记录</a>
        <a href="<{$POINT_RULE_URL}>" class="rule">积分规则</a>
    </div>
    <{if $list}>
    <ul class="goods-list">
        <{include file="PointMall_v2/indexMore.html"}>
    </ul>
    <{else}>

    <{/if}>
    <div class="past">
        <a href="<{U('PointMall/endList')}>">查看往期商品<i></i></a>
    </div>


</div>



    <{*include file="footer.html" *}>
</body>
</html>
<script src="<{$preStaticUrl}>Wap/v2/js/swiper-3.3.1.min.js"></script>
<script>
    $(function(){
        var mySwiper = new Swiper ('.swiper-container', {
            loop: true,
            autoplay: 3000,
            autoplayDisableOnInteraction: false
        })
    })
</script>
<script type="text/javascript">

    $(document).ready(function () {
        $dragBln = false;

        timeout();
        function timeout(){
            var $point_timeer = $('.timeCounter');
            $point_timeer.each(function() {
                var time = parseInt($(this).data("time"));
                if(time>0 && time){
                    output_time(time,this);
                }
                $(this).data("time",--time);
            });
            setTimeout(function (){timeout();},1000);
        }
        function output_time (time,obj) {
                    var hour = Math.floor(time/60/60);
                    var minute = Math.floor((time/60)%60);
                    var scond = Math.floor(time%60);
                    var day = Math.floor(hour/24);

                    if(hour>24){
                        hour = hour%24;
                        $(obj).html("距开始 "+day+"天"+hour+"小时");
                    }else if(hour > 1 && hour <=24){
                        $(obj).html("距开始 "+hour+"小时"+minute+"分");
                    }else if(hour <=1){
                        $(obj).html("距开始 "+minute+"分"+scond+"秒");
                    }
        }
        load_more({page:page,pos:"PointMallIndexMore"});
    });

</script>
<script>
    //拖动加载
    var  flagData  =  true;
    var  flagAjax  =  true;
    var  page      =  2;
    //加载
    function  load_more(postData){
        //$("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
        //$("#load_more  span").html('正在加载...');
        if(! flagAjax){
            return  false;
        }
        flagAjax  =  false;
        $.post("<{u('PointMall/indexMore')}>",postData,function(data){
            if(page <= data.totalPage)  {
                $(".goods-list").append(data.dataHTML);
               // $("#load_more  span").html('加载更多');
                page++;
                flagAjax  =  true;
               // $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
            }  else  {
                flagData  =  false;
               //$("#load_container").html('<div class="formerly_box"><a  href="<{U('PointMall/endList')}>"  id="load_more"><div class="formerly_topic"></div></a></div>');
                //$("#load_more").css({'background':'url("")'}).css({'padding-top':'0'}).css({'top':'0px'}).css({'position':'relative'});
            }
        },'json');
    }
    var  tmp_scroll  =  0;
    //拖动加载
    function  scroll_load(postData){
        if  (tmp_scroll  ==  $(window).height()  +  $(window).scrollTop())  {
            return;
        }
        tmp_scroll  =  $(window).height()  +  $(window).scrollTop();
        var  jia_scroll  =  $(document).height()  -  ($(window).height()  +  $(window).scrollTop());
        if  (jia_scroll  <  100  &&  flagData)  {
            load_more(postData);
        }
    }
    $(window).scroll(function(){
        scroll_load({page:page,pos:"PointMallIndexMore"});
    });
</script>
